package com.laborder.sysyy.service.labOrder.impl;

import com.laborder.sysyy.constant.BussinessCode;
import com.laborder.sysyy.dao.LabOrderDaoMapper;
import com.laborder.sysyy.entity.BussinessMsg;
import com.laborder.sysyy.entity.LabOrder;
import com.laborder.sysyy.service.labOrder.LabOrderService;
import com.laborder.sysyy.utils.BussinessMsgUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author 786107529@qq.com FJL
 * @Date 2018/9/10 11:42
 */
@Service
@Transactional
public class LabOrderServiceImpl implements LabOrderService {
    @Autowired
    private LabOrderDaoMapper labOrderDaoMapper;
    @Override
    public List<LabOrder> findLabOrderWithPage(Map<String,Object> map) {

        return labOrderDaoMapper.findLabOrderWithPage(map);
    }
    @Override
    public int getLabOrderCount(Map<String,Object>map) {
        return labOrderDaoMapper.getLabOrderCount(map);
    }

    @Override
    public  int saveLabOrderInfo(LabOrder laborder) {
        return labOrderDaoMapper.saveLabOrderInfo(laborder);
    }
    @Override
    public int delLabOrderInfo(String loId) {
        return labOrderDaoMapper.delLabOrderInfo(loId);
    }
    @Override
    public int updateLabOrderInfo(LabOrder laborder) {
        return labOrderDaoMapper.updateLabOrderInfo(laborder);
    }
    @Override
    public LabOrder  findSateInfoById(String loId) {
        return labOrderDaoMapper.findSateInfoById(loId);
    }
    @Override
    public LabOrder  getLabOrderInfoById(String loId) {
        return labOrderDaoMapper.getLabOrderInfoById(loId);
    }
    @Override
    public BussinessMsg changeLockState(Map<String,Object>map){
        if(labOrderDaoMapper.changeLockState(map)!=0)
            return BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_SUCCESS);
        return  BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_ERROR);
    }
    @Override
    public BussinessMsg removeLockState(Map<String,Object>map){
        if(labOrderDaoMapper.changeLockState(map)!=0)
            return BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_SUCCESS);
        return  BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_ERROR);
    }
    @Override
    public BussinessMsg labOrderDown(Map<String,Object>map){
        if(labOrderDaoMapper.changeLockState(map)!=0)
            return BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_SUCCESS);
        return  BussinessMsgUtil.returnCodeMessage(BussinessCode.GLOBAL_ERROR);
    }
}
